import { reactive, onMounted } from "vue";
export default function useMousePoint() {
    interface PointType {
        x: number;
        y: number;
    }
    const point = reactive<PointType>({ x: -1, y: -1 });
    const reset = () => {
        point.x = -1;
        point.y = -1;
    };
    onMounted(() => {
        //DOM的操作要在mounted之后进行
        document.onclick = function (e: MouseEvent) {
            console.log(e.clientX, e.clientY);
            point.x = e.clientX;
            point.y = e.clientY;
        };
    });
    return {
        point,
        reset
    }
}